Skip to content

Run event tracking and duplicate runStarted fix#1502

Open
DNR500 wants to merge 2 commits into
mainfrom
1483-tracking-events
Open

Run event tracking and duplicate runStarted fix#1502
DNR500 wants to merge 2 commits into
mainfrom
1483-tracking-events

Conversation

@DNR500

@DNR500 DNR500 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Relates to issues:
1483
1520

Relates to editor-standalone#954.

Summary

Fixes a bug where HTML and Python projects dispatched editor-runStarted twice on the first Run click, and extends editor-runCompleted so editor-standalone can build Project - Run completed events with structured error data.

Duplicate editor-runStarted

Run-started and run-completed logic lived in one useEffect. After the first runStarted dispatch, setCodeHasRun(true) re-ran that effect while codeRunTriggered was still true, so the event fired again. This splits those into separate effects and only dispatches runStarted when codeRunTriggered goes from false to true.

editor-runCompleted payload for run tracking

Adds to the existing editor-runCompleted event (which already included isErrorFree and Mission Zero fields):

  • projectIdentifier and projectType on runStarted and runCompleted
  • errorDetails on standard editor runs (previously only sent in outputOnly mode)
  • friendlyErrorShown - whether PFEM was displayed

editor-standalone uses this to post Project - Run completed with error_fingerprint and error_style.

Copilot AI review requested due to automatic review settings June 17, 2026 17:18
@DNR500 DNR500 temporarily deployed to previews/1502/merge June 17, 2026 17:18 — with GitHub Actions Inactive

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a web-component analytics/eventing bug where HTML and Python projects could dispatch editor-runStarted twice on the first Run click by decoupling “run started” from “run completed” side-effects and gating runStarted to only fire on the codeRunTriggered rising edge.

Changes:

  • Split runStarted and runCompleted dispatch logic into separate useEffect hooks.
  • Add a useRef guard to ensure editor-runStarted only fires when codeRunTriggered transitions false → true.
  • Strengthen the unit test to assert editor-runStarted fires exactly once.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/components/WebComponentProject/WebComponentProject.jsx Prevents duplicate editor-runStarted dispatch by tracking prior codeRunTriggered state and separating effects.
src/components/WebComponentProject/WebComponentProject.test.js Updates test setup and assertion to verify editor-runStarted fires only once.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1174d2a. Configure here.

isErrorFree: error === "",
step: currentStepPosition,
errorDetails,
friendlyErrorShown: Boolean(friendlyError?.html),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale friendly error tracking flag

Medium Severity

The new friendlyErrorShown field on editor-runCompleted is derived only from friendlyError?.html in Redux. Skulpt clears error and errorDetails at run start but does not clear friendlyError, so a successful run after a failed one can still emit friendlyErrorShown: true while isErrorFree is true.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1174d2a. Configure here.

@DNR500 DNR500 changed the title fix: ensure first tracking events for html/python projects only fire once Run event tracking and duplicate runStarted fix Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants